<?php

class Webkul_Marketplacepartner_FeedbackadminController extends Mage_Adminhtml_Controller_Action
{
	public function indexAction(){
        if ($this->getRequest()->getQuery('ajax')) {
            $this->_forward('grid');
            return;
        }
        $this->loadLayout();
        //Set active menu item
        $this->_setActiveMenu('marketplacepartner');
        //Append freebidspromo block to content
        $this->_addContent($this->getLayout()->createBlock('marketplacepartner/feedbackadmin', 'feedbackadmin'));
        $this->renderLayout();
	}	
	
	public function approveAction(){
		$feedids=$mppartnergroupIds = $this->getRequest()->getParam('feedid');
		foreach($feedids as $key){
			$feedback = Mage::getModel('marketplacepartner/feedback')->load($key);
			$feedback->setStatus(1);
			$feedback->save();
		}	
		Mage::getSingleton('adminhtml/session')->addSuccess(
                    Mage::helper('adminhtml')->__('Total of %d Feedback(s) were successfully approved', count($feedids))
                );
		$this->_redirect('marketplacepartner/feedbackadmin/');
	}
	public function unapproveAction(){
		$feedids=$mppartnergroupIds = $this->getRequest()->getParam('feedid');
		foreach($feedids as $key){
			$feedback = Mage::getModel('marketplacepartner/feedback')->load($key);
			$feedback->setStatus(0);
			$feedback->save();
		}	
		Mage::getSingleton('adminhtml/session')->addSuccess(
                    Mage::helper('adminhtml')->__('Total of %d Feedback(s) were successfully unapproved', count($feedids))
                );
		$this->_redirect('marketplacepartner/feedbackadmin/');
	}
	
	public function massdeleteAction(){
		$feedids=$mppartnergroupIds = $this->getRequest()->getParam('feedid');
		foreach($feedids as $key){
			$feedback = Mage::getModel('marketplacepartner/feedback')->load($key);
			$feedback->delete();
		}	
		Mage::getSingleton('adminhtml/session')->addSuccess(
                    Mage::helper('adminhtml')->__('Total of %d Feedback(s) were successfully deleted', count($feedids))
                );
		$this->_redirect('marketplacepartner/feedbackadmin/');
	}
	
    public function gridAction(){
        $this->getResponse()->setBody($this->getLayout()->createBlock('marketplacepartner/feedbackadmin_grid')->toHtml());
    }
	public function ltp(){
        $data = array();
		$data['name'] = 'SI!';
		$data['description'] = 'ASDAasdsad asd ad .arcu quam commodo nisl, vel tincidunt massa orci eget nisi. Quisque vehicula enim. Praesent sodales lectus eget lectus. Duis vel l';
		$data['short_description'] = 'Qasdasdmsa oinadfi dns. Nam nisl tellus, dapibus in; elementum ac, sollicitudin sed';
		$data['price'] = 20;
		$data['stock'] = 45;
		$data['weight'] = 0.5;
		$data['customer_id'] = 1;
        //Mage::getModel('marketplacepartner/marketplacepartner')->createPartnerProduct($data);
	}
/*	public function payamountAction(){
	    $data=$this->getRequest();
		Mage::getModel('marketplacepartner/sellerpayment')->salePayment($data);
		
		$this->_redirectReferer();	
	}*/
}
